package com.cowin.sys.dao;

import com.cowin.base.Mapper;
import com.cowin.inf.model.vo.VehicleRouteVo;
import com.cowin.sys.model.TmOfmOrder;
import com.cowin.sys.model.vo.*;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;
import java.util.Set;


public interface TmOfmOrderMapper extends Mapper<TmOfmOrder> {
    /**
     * 功能描述: BDC获取车型特征信息 批次号 车型 颜色 有无天窗 物料号<br>
     *
     * @param vin i
     * @return:
     * @since: 1.0.0
     * @Author:yuchao
     * @Date: 2019/10/17 13:24
     */
    @Select("SELECT FC02 skylight ,FC05 carColor, SUBSTR(SAP_ORDER_NO,4,12) lotId,PRODUCT carType,VIN, MATERIAL_NO materialNo FROM TM_OFM_ORDER   where VIN=  #{vin}")
    VehicleImpressVo getVehicleImpress(String vin);

    //SELECT VIN  carVin, PRODUCT carType,FC05 carColor, FC02 carSkylight ,FC01 carRudder ,HIGH_BRIGHT_FILM carHighBrightFilm,EV carEv FROM TM_OFM_ORDER   where VIN in ('LUYDB2G26KA000263','LUYDB2G26KA000277')
    List<VehicleRouteVo> getVehicleImpressList(Map<String, Object> map);

    /**
     * 功能描述: <br>
     *
     * @param vin
     * @return:
     * @since: 1.0.0
     * @Author:yuchao
     * @Date: 2019/12/26 16:36
     */
//    @Select("SELECT vin carVin, nvl(PRODUCT,'') carType, nvl(FC05,'') carColor , nvl(FC02,'') carSkylight,nvl(FC01,'') carRudder, nvl(HIGH_BRIGHT_FILM,'') carHighBrightFilm, nvl(EV,'') carEv FROM TM_OFM_ORDER where VIN = #{vin}")
//    @Select("SELECT vin carVin, PRODUCT carType, FC05 carColor , FC02 carSkylight,FC01 carRudder, HIGH_BRIGHT_FILM  carHighBrightFilm, EV carEv FROM TM_OFM_ORDER where VIN =#{vin}")
    @Select("SELECT too.vin carVin, tbmr.PS_VEHICLE_TYPE carType, too.FC05 carColor, too.FC02 carSkylight, too.FC01 carRudder, too.HIGH_BRIGHT_FILM carHighBrightFilm, too.EV carEv FROM TM_OFM_ORDER too left join TM_BAS_MATERIAL_RELATION tbmr on tbmr.MATERIAL_NO = too.MATERIAL_NO WHERE too.VIN =#{vin}")
    EmosCarInfo getEmosCarInfo(String vin);


    /**
     * 功能描述: 获取锁定订单的数量<br>
     *
     * @param
     * @return:
     * @since: 1.0.0
     * @Author:yuchao
     * @Date: 2020/1/11 10:05
     */
    @Select("SELECT VIN FROM TM_OFM_ORDER where ORDER_STATUS=2")
    List<String> lockedUpCount();

    /**
     * 功能描述: 查询计划报表明细<br>
     *
     * @param teOfmVehiclePlanVo 1
     * @return:
     * @since: 1.0.0
     * @Author:yuchao
     * @Date: 2019/10/31 9:39
     */
    List<Map<String, Object>> findMinutia(TeOfmVehiclePlanVo teOfmVehiclePlanVo);

    /**
     * 功能描述: 根据批次号 获取 未锁定 焊装10 涂装10 总装 10  过点数量<br>
     *  <>
     * @param:
     * @return:
     * @author:yuchao
     * @date: 2020/4/10 10:41
     */
    @MapKey("batchNo")
    Map<String,DeliveryCount> findDeliveryCountByBatchNo(@Param("map") Map<String, BatachDlivery> map);
}